package Laboratorio;

import java.awt.*;

import javax.swing.*;

public class esempioSfondo extends JPanel {

	private static final long serialVersionUID = 1L;
	private Image img;

	public esempioSfondo() {
		setLayout(null);
		/*
		img = Toolkit.getDefaultToolkit().createImage(
				"C:\\Users\\Paco\\Desktop\\a.jpg");
		//loadImage(img);
		*/
		JLabel l = new JLabel(new ImageIcon("C:\\Users\\Paco\\workspace\\Esercizi Vari\\images\\a.jpg"));
		l.setBounds(0,0, 500,374);
		this.add(l);
		
	}

	@SuppressWarnings("unused")
	private void loadImage(Image img) {
		try {
			MediaTracker track = new MediaTracker(this);
			track.addImage(img, 0);
			track.waitForID(0);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	protected void paintComponent(Graphics g) {
		setOpaque(false);
		g.drawImage(img, 0, 0, null);
		super.paintComponent(g);
	}
}
